package map;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;

public class UsuariosDAO {
	
	public void addUsuario(String nombre){
		String spName = "{call dbo.alta_usuario (?)}";
		Connection con = new ConfigDAO().getConnection();
		CallableStatement cstmt = null;
		
		try {
			cstmt = con.prepareCall(spName);
			cstmt.setString(1, nombre);
			cstmt.executeUpdate();
			cstmt.getConnection().close();

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	public void delUsuario(String nombre){
		String spName = "{call dbo.baja_usuario (?)}";
		Connection con = new ConfigDAO().getConnection();
		CallableStatement cstmt = null;
		
		try {
			cstmt = con.prepareCall(spName);
			cstmt.setString(1, nombre);
			cstmt.executeUpdate();
			cstmt.getConnection().close();

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
